package com.mall.canal.spring;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * @author Darren
 * @date 2022-10-09 14:03
 * Description：
 */
@Component
public class SpringContext implements ApplicationContextAware {
    private static ApplicationContext act;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        act = applicationContext;
    }

    public static <T> T getBean(Class<T> clazz) {
        return act.getBean(clazz);
    }
}
